﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Manage_Service_editCourse : ManagePageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string cid = Request.Form["cid"].Trim();
        string cname = Request.Form["cname"].Trim();
        string klist = Request.Form["klist"].Trim();
        if (!IsPostBack)
        {
            try
            {
                bool result = new Exam.Core.DAL.Course().EditCourse(cid, cname);
                if (klist.Trim() != "")
                {
                    List<string> SQLList = new List<string>();
                    string[] knows = klist.Split('|');
                    foreach (string str in knows)
                    {
                        string[] knowledge = str.Split('$');
                        if (knowledge.Length == 2)
                        {
                            string SQL = "UPDATE Knowledge SET KnowledgeTitle='" + Server.HtmlEncode(knowledge[1].Trim()) + "' WHERE KnowledgeId=" + knowledge[0];
                            SQLList.Add(SQL);
                        }
                    }
                    if (SQLList.Count > 0)
                    {
                        int r = new Exam.Core.DAL.Knowledge().ExecuteSqlTranByList(SQLList);
                    }
                }
                Response.Write("1");
            }
            catch
            {
                Response.Write("0");
            }
            Response.End();
        }
        //if (klist.Trim() != "")
        //{

        //}
    }
}